Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jellyfish-api-core): Add updatemasternode RPC typings #1847

Merged
merged 36 commits into from
Nov 29, 2022

Conversation

marktanrj
Copy link
Contributor

@marktanrj marktanrj commented Nov 1, 2022

What this PR does / why we need it:

  • Add RPC updatemasternode

Which issue(s) does this PR fixes?:

Fixes part of #1842

@marktanrj marktanrj changed the title Add RPC updatemasternode feat(jellyfish-api-core): Add RPC updatemasternode Nov 1, 2022
@github-actions github-actions bot added the kind/feature New feature request label Nov 1, 2022
@marktanrj marktanrj changed the title feat(jellyfish-api-core): Add RPC updatemasternode feat(jellyfish-api-core): Add updatemasternode RPC typings Nov 1, 2022
@marktanrj marktanrj marked this pull request as draft November 1, 2022 04:49
@marktanrj marktanrj changed the base branch from marktanrj/updatemasternode to main November 14, 2022 03:03
@marktanrj marktanrj marked this pull request as ready for review November 15, 2022 06:44
@netlify
Copy link

netlify bot commented Nov 15, 2022

Deploy Preview for jellyfishsdk ready!

Name Link
🔨 Latest commit b995da1
🔍 Latest deploy log https://app.netlify.com/sites/jellyfishsdk/deploys/6373352d0f8fa100089852b4
😎 Deploy Preview https://deploy-preview-1847--jellyfishsdk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codeclimate
Copy link

codeclimate bot commented Nov 15, 2022

Code Climate has analyzed commit 399b613 and detected 0 issues on this pull request.

View more on Code Climate.

@netlify
Copy link

netlify bot commented Nov 15, 2022

Deploy Preview for jellyfishsdk ready!

Name Link
🔨 Latest commit 399b613
🔍 Latest deploy log https://app.netlify.com/sites/jellyfishsdk/deploys/638595c7f2e7090008075e72
😎 Deploy Preview https://deploy-preview-1847--jellyfishsdk.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@codecov
Copy link

codecov bot commented Nov 15, 2022

Codecov Report

Base: 90.81% // Head: 92.12% // Increases project coverage by +1.31% 🎉

Coverage data is based on head (399b613) compared to base (a6e96d4).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1847      +/-   ##
==========================================
+ Coverage   90.81%   92.12%   +1.31%     
==========================================
  Files         357      361       +4     
  Lines       10430    10477      +47     
  Branches     1316     1320       +4     
==========================================
+ Hits         9472     9652     +180     
+ Misses        912      786     -126     
+ Partials       46       39       -7     
Impacted Files Coverage Δ
...ages/jellyfish-api-core/src/category/masternode.ts 96.00% <100.00%> (+16.83%) ⬆️
...atus-api/src/controllers/OracleStatusController.ts 19.56% <0.00%> (-78.27%) ⬇️
...s/playground-api-client/src/PlaygroundRpcClient.ts 33.33% <0.00%> (-66.67%) ⬇️
...ckages/jellyfish-network/src/TransactionSkipped.ts 37.50% <0.00%> (-50.00%) ⬇️
apps/libs/blockchaincpp/src/BlockchainCppModule.ts 50.00% <0.00%> (-38.24%) ⬇️
packages/jellyfish-wallet-mnemonic/src/hd_node.ts 67.79% <0.00%> (-28.82%) ⬇️
packages/whale-api-client/src/api/masternodes.ts 71.42% <0.00%> (-28.58%) ⬇️
...transaction-builder/src/txn/txn_builder_account.ts 67.56% <0.00%> (-27.03%) ⬇️
...jellyfish-transaction/src/script/dftx/dftx_misc.ts 75.00% <0.00%> (-25.00%) ⬇️
packages/whale-api-client/src/api/address.ts 77.77% <0.00%> (-22.23%) ⬇️
... and 66 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link

github-actions bot commented Nov 15, 2022

Docker build preview for jellyfish/apps is ready!

Built with commit 428f618

  • ghcr.io/jellyfishsdk/legacy-api:pr-1847
  • ghcr.io/jellyfishsdk/ocean-api:pr-1847
  • ghcr.io/jellyfishsdk/playground-api:pr-1847
  • ghcr.io/jellyfishsdk/status-api:pr-1847
  • ghcr.io/jellyfishsdk/whale-api:pr-1847

You can also get an immutable image with the commit hash

  • ghcr.io/jellyfishsdk/legacy-api:428f618e45153512d51f01070f4c011cb320ad8a
  • ghcr.io/jellyfishsdk/ocean-api:428f618e45153512d51f01070f4c011cb320ad8a
  • ghcr.io/jellyfishsdk/playground-api:428f618e45153512d51f01070f4c011cb320ad8a
  • ghcr.io/jellyfishsdk/status-api:428f618e45153512d51f01070f4c011cb320ad8a
  • ghcr.io/jellyfishsdk/whale-api:428f618e45153512d51f01070f4c011cb320ad8a

Copy link
Contributor

@shohamc1 shohamc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imkven
Copy link
Contributor

imkven commented Nov 27, 2022

I have referred to /test/functional/rpc_updatemasternode.py to write tests in updatemasternode.test.ts but I have 2 tests that do not get the error message in Python. Can you help check? @shohamc1 CC @marktanrj @infinia-yzl

○ skipped Test owner update without collateral input
○ skipped Node 1 try to update node 0 which should be rejected

@shohamc1
Copy link
Contributor

○ skipped Test owner update without collateral input

This test requires manually building an incorrect transaction, I think it is better suited for the tests on #1863

○ skipped Node 1 try to update node 0 which should be rejected

Fixed in ca6ca20, but we should refactor the tests in the PR to use the TestingGroup on all tests.

infinia-yzl
infinia-yzl previously approved these changes Nov 28, 2022
@infinia-yzl infinia-yzl requested a review from shohamc1 November 28, 2022 09:54
shohamc1
shohamc1 previously approved these changes Nov 28, 2022
Copy link
Contributor

@shohamc1 shohamc1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Contributor

@fuxingloh fuxingloh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with 1 minor change for clarity

@imkven imkven dismissed stale reviews from shohamc1 and infinia-yzl via f4620aa November 29, 2022 03:34
Copy link
Contributor

@infinia-yzl infinia-yzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State is fully deterministic.

Copy link
Contributor

@fuxingloh fuxingloh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a few suggestions that we don't have to apply now. More than 2000 test cases, I believe, are written in the "old style" that has been discouraged now.


it('should updateMasternode with utxos', async () => {
const balance = await container.call('getbalance')
expect(balance >= 2).toBeTruthy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinda weird to write it like this, it should be

Suggested change
expect(balance >= 2).toBeTruthy()
expect(balance).toBeGreaterThanOrEqual(2)

Comment on lines +401 to +403
expect(masternodes[masternodeId]).toBeTruthy()
expect(masternodes[masternodeId].state).toStrictEqual('TRANSFERRING')
expect(masternodes[masternodeId].ownerAuthAddress).toStrictEqual(initialAddress)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(masternodes[masternodeId]).toBeTruthy()
expect(masternodes[masternodeId].state).toStrictEqual('TRANSFERRING')
expect(masternodes[masternodeId].ownerAuthAddress).toStrictEqual(initialAddress)
expect(data).toStrictEqual(expect.objectContaining({
state: 'TRANSFERRING',
ownerAuthAddress: initialAddress
}))

For better readability, it's better to write tests like this. Most of the tests written previously were written the previous "style" that we've since discouraged. We don't have to change it now but just a thought for the future.

@fuxingloh fuxingloh merged commit 68d604a into main Nov 29, 2022
@fuxingloh fuxingloh deleted the marktanrj/updatemasternode-rpc-typing branch November 29, 2022 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants